﻿using System;
using LogikBug.Async.Tasks.Entities;

namespace LogikBug.Async.Tasks
{
	public class ActionAgent : Agent<ActionModel>
	{
		public ActionAgent(Action action) : this(ActionModel.Create(action))
		{
		}

		public ActionAgent(ActionModel action) : base(action)
		{
		}

		public override void Execute()
		{
			Model.Invoke();
		}
	}

	public class ActionAgent<T> : Agent<ActionModel<T>>
	{
		public ActionAgent(T item, Action<T> action) : this(ActionModel.Create(item, action))
		{
		}

		public ActionAgent(ActionModel<T> actionModel) : base(actionModel)
		{
		}

		public override void Execute()
		{
			Model.Invoke();
		}
	}

	public class ActionAgent<T1, T2> : Agent<ActionModel<T1, T2>>
	{
		public ActionAgent(T1 item1, T2 item2, Action<T1, T2> action) : this(ActionModel.Create(item1, item2, action))
		{
		}

		public ActionAgent(ActionModel<T1, T2> actionModel) : base(actionModel)
		{
		}

		public override void Execute()
		{
			Model.Invoke();
		}
	}
}
